<?php
/**
 * 【超人】模块定义
 *
 * @author 超人
 * @url http://s.w7.cc/developer/index/59968
 */
defined('IN_IA') or exit('Access Denied');
global $_W, $_GPC;
$act = in_array($_GPC['act'], array('display'))?$_GPC['act']:'display';
if ($act == 'display') {
    $orderid = 1; //TODO
    $money = 0.01; //TODO
    $params = array(
        'tid' => $orderid,
        'user' => $_W['openid'],
        'fee' => $money,
        'title' => '测试小程序支付功能',
    );
    $result = $this->pay($params);
    if (is_error($result)) {
        SupermanTestUtil::logging('fatal', '[pay] failed, result='.var_export($result, true));
        return $this->json(-1, '支付失败，请重试');
    }

    //发送模板消息需要prepay_id参数，可保存到数据库备用
    //$prepay_id = str_replace('prepay_id=', '', $result['package']);
    //pdo_update('', array(), array());

    $this->json(ERRNO::OK, '', $result);
}
